package com.lc.dubbox.provider;

import com.lc.dubbox.api.UserService;
import com.lc.dubbox.entity.User;
import org.springframework.stereotype.Service;

import java.util.concurrent.atomic.AtomicLong;

/**
 * Created by lichao on 18/1/26.
 */
//此实现类不走dubbo接口,使用的是spring的注解(springboot)
@Service
public class UserServiceImpl implements UserService {

    private static AtomicLong acl = new AtomicLong();

    @Override
    public User getUser(Long id) {
        User user = new User();
        user.setId(id);
        user.setName("Beckham");
        return user;
    }

    @Override
    public Long registerUser(User user) {
        user.setId(acl.incrementAndGet());
        return user.getId();
    }
}
